<template>
	<view class="record_head">
		<uv-sticky offset-top="0" custom-nav-height="0">
			<view class="header-top">
				<view class="status_bar">
				</view>
				<view class="box">
					<view class="nav">
						<view class="nav-box" @click="switchopc">
							<text class="nav-text">
								低压电工作业
							</text>
							<view class="icon">
								<text style="font-size: 24rpx;">切换工种</text>
								<text class="iconfont icon-down2">
								</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</uv-sticky>
		<view class="record-body">
			<view class="record-mind">
				<view class="record-mind-nav">
					<text class="on">理论考试</text>
					<text>科目四</text>
					<text>科目四</text>
					<text>科目四</text>
					<text>科目四</text>
				</view>
				<view class="record-mind-data">
					<text class="record-mind-data-title">今日数据</text>
					<button class="share">分享</button>
					<view class="record-mind-data-list">
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">65</text>
							<text>正确率</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">65</text>
							<text>正确率</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
						<view class="record-mind-data-item">
							<text class="num">1990</text>
							<text>做题数量</text>
						</view>
					</view>
				</view>
			</view>
			<view style="margin: 30rpx;" class="btn-red exam-btn">
				<view class="exam-btn-txt">
					<text class="title">考试记录</text>
					<text class="look">去查看你所有的考试记录</text>
				</view>
				<view class="exam-btn-btn">去查看</view>
			</view>
			<view class="my">
				<view class="my-item">
					<view class="my-item-txt">
						<text class="title">我的错题</text>
						<text class="num">1题</text>
					</view>
					<view class="iconfont icon-cuowu2"></view>
				</view>
				<view class="my-item">
					<view class="my-item-txt">
						<text class="title">我的收藏</text>
						<text class="num">1题</text>
					</view>
					<view class="iconfont icon-shoucang"></view>
				</view>
			</view>
		</view>
		<uni-popup borderRadius="10px 10px 0 0" ref="opcpopup" type="bottom" background-color="#fff">
			<view class="opc_pop">
				<view class="opc_pop_title">
					<view class="left">
						<text class="iconfont icon-qiehuan"></text><text>工种切换</text>
					</view>
					<uni-icons type="closeempty" color="#fff" size="24" @click="closeOpcPop"></uni-icons>
				</view>
				<view class="opc_list">
					<view class="opc_list-row" :class="select_opc==item.opc?'on':''" @click="clickOpc(item)"
						v-for="(item,index) in list">
						<text>{{item.opcname}}</text>
						<text :class="select_opc==item.opc?'iconfont icon-zhengque':'iconnone'"></text>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>

</template>

<script>
	export default {

		data() {
			return {
				list: [{
						opc: '030201',
						opcname: '熔化焊接与热切割作业'
					}, {
						opc: '030102',
						opcname: '低压电工作业'
					},
					{
						opc: '030101',
						opcname: '高压电工作业'
					},
					{
						opc: '030302',
						opcname: '高处安装、维护、拆除作业'
					},
					{
						opc: '030301',
						opcname: '登高架设作业'
					},
					{
						opc: '030401',
						opcname: '制冷与空调设备运行操作作业'
					},

				],
				select_opc: '',
			};
		},
		onLoad() {

		},
		methods: {
			switchopc() {
				this.$refs.opcpopup.open()
			},
			closeOpcPop() {
				this.$refs.opcpopup.close()
			},
			clickOpc(item) {
				this.select_opc = item.opc
				// this.opcData = item
				this.$emit('opcClick', item)
				let countdownMilliseconds = 500;
				// 设置定时器，每秒更新一次倒计时  
				const countdownTimer = setInterval(() => {
					countdownMilliseconds -= 500;
					// 当倒计时结束时清除定时器  
					if (countdownMilliseconds <= 0) {
						clearInterval(countdownTimer);
						this.$refs.opcpopup.close()
					}
				}, 500); // 1000毫秒 = 1秒
			}
		}
	}
</script>

<style lang="scss" scoped>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
		opacity: 0;
	}

	.record_head {
		background: $uni-gradient-primary;
		background-size: 100% 400rpx;
		background-repeat: no-repeat;

		.header-top {
			.box {
				color: #fff;
				position: relative;
				// height: 400rpx;
				width: 100%;
				/* #ifndef WEB */
				padding-bottom: 20rpx;
				/* #endif */
			}

			.position {
				align-self: center;
				font-size: 34rpx;
				position: absolute;
				left: 34rpx;
				z-index: 3;
				/* #ifdef WEB */
				top: 50%;
				transform: translate(0, -50%);
				/* #endif */

				/* #ifndef WEB */
				top: 50%;
				transform: translate(0, -50%);
				/* #endif */


			}

			.nav {
				padding: 5px 0;

				.nav-box {
					font-weight: 600;
					font-size: 34rpx;
					padding: 0 30rpx;
					display: flex;
					align-items: center;
					justify-content: flex-start;
					border-radius: 50rpx;
					color: #fff;
					font-weight: 700;
					height: 60rpx;

					.nav-text {
						margin-right: 8px;
					}

					.icon {
						font-size: 28rpx;
						color: #fff;
						padding-left: 10rpx;

						.iconfont {
							font-size: 20rpx;
						}
					}
				}
			}
		}
	}

	page {
		background: #F3F3F3;
	}

	.opc_pop {
		// padding: 30rpx;
		border-radius: 20rpx 20rpx 0 0;
		overflow: hidden;

		.opc_pop_title {
			padding: 30rpx 30rpx;
			background: #FE7B73;
			color: #fff;
			display: flex;
			justify-content: space-between;
			font-size: 32prx;
			font-weight: 700;

			.left {
				.iconfont {
					margin-right: 10rpx;
				}
			}

		}

		.opc_list {
			color: #7C7166;
			font-size: 28rpx;
			padding: 0 30rpx;

			.on {
				color: #FD3523;
			}

			text {
				transition: .5 all;
			}

			.opc_list-row {
				display: flex;
				justify-content: space-between;
				padding: 30rpx 0;
				border-bottom: 1px solid #00000030;
			}

			.iconnone {
				border: 3rpx solid #333333;
				border-radius: 50%;
				width: 30rpx;
				height: 30rpx;
			}

			.icon-zhengque {
				font-size: 40rpx;
			}
		}
	}

	.list-enter-active,
	.list-leave-active {
		transition: opacity 0.5s, transform 0.5s;
	}

	.list-enter,
	.list-leave-to

	/* .list-leave-active in <2.1.8 */
		{
		opacity: 0;
		transform: translateY(30px);
	}

	.record-body {
		position: relative;
		// top: -260rpx;
		padding-bottom: 60rpx;
	}

	.record-mind {
		margin: 0 30rpx;
		box-shadow: 1rpx 2rpx 20rpx 1rpx rgba(97, 69, 65, 0.1);
		border-radius: 20rpx 20rpx;
		background: #FFFFFF;

		.record-mind-nav {
			background: #383131;
			border-radius: 20rpx 20rpx 0 0;
			height: 92rpx;
			font-weight: 600;
			font-size: 32rpx;
			color: #FFFFFF;
			display: flex;
			overflow: hidden;

			text {
				flex: 1;
				text-align: center;
				line-height: 92rpx;
				position: relative;

				// border-radius: 20rpx 20rpx 0 0;
				&:first-child {
					border-bottom-left-radius: 0;
				}

				&:last-child {
					// &:before {
					// 	right: 0rpx;
					// 	left: -20rpx;
					// 	border-left: 36rpx solid transparent;
					// 	border-right: 0rpx solid transparent;
					// 	border-bottom: 36rpx solid #E94030;

					// }
					border-bottom-right-radius: 0;
				}
			}

			.on {
				background-color: #E94030;

				// &:before {
				// 	content: '';
				// 	position: absolute;
				// 	right: -20rpx;
				// 	bottom: 0;
				// 	width: 0;
				// 	height: 0;
				// 	border-left: 0px solid transparent;
				// 	border-right: 36rpx solid transparent;
				// 	border-bottom: 36rpx solid #E94030;
				// }
			}
		}

		.record-mind-data {
			padding: 0 30rpx;
			margin-bottom: 60rpx;
			position: relative;

			.share {
				font-size: 26rpx;
				width: 110rpx;
				height: 56rpx;
				border-radius: 40rpx 0 0 40rpx;
				background: #E94030;
				color: #fff;
				position: absolute;
				right: 0;
				top: 28rpx;
				text-align: center;
				line-height: 56rpx;
			}

			.record-mind-data-title {
				font-weight: 700;
				font-size: 30rpx;
				color: #0E0E10;
				display: block;
				padding: 35rpx 0;
			}

			.record-mind-data-list {
				display: grid;
				grid-template-columns: repeat(4, 1fr);

				// gap: 5px;
				.record-mind-data-item {
					position: relative;
					padding-bottom: 50rpx;

					&:nth-child(4n) {
						&:before {
							display: none;
						}
					}

					&:before {
						content: '';
						position: absolute;
						right: 0;
						width: 2rpx;
						height: 68rpx;
						background: #d0d0d0;
						top: 20%;
						// transform: translate(0,-50%);
					}

					text {
						display: block;
						text-align: center;
						font-weight: 400;
						font-size: 26rpx;
						color: #1E1E20;
					}

					.num {
						font-weight: 500;
						font-size: 40rpx;
						color: #1E1E20;
						padding-bottom: 15rpx;
					}
				}
			}
		}
	}

	.my {
		display: flex;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		grid-column-gap: 25rpx;
		margin: 0 30rpx;

		.my-item {
			background: #FFFFFF;
			box-shadow: 3rpx 3rpx 8rpx 0rpx rgba(230, 230, 230, 0.27);
			border-radius: 10rpx;
			display: flex;
			align-items: center;
			justify-content: space-around;
			height: 142rpx;

			text {
				display: block;
				text-align: left;
			}

			.title {
				font-weight: 700;
				font-size: 32rpx;
				color: #101010;
				margin-bottom: 10rpx;
			}

			.num {
				font-weight: 500;
				font-size: 26rpx;
				color: #979898;
			}

			.icon-shoucang {
				background: $uni-gradient-primary;
				box-shadow: 0px 6rpx 18rpx 0px rgba(254, 169, 4, 0.4);

			}

			.icon-cuowu2 {
				background: $uni-gradient-primary;
				box-shadow: 0px 6rpx 18rpx 0px rgba(251, 82, 83, 0.4);
			}

			.iconfont {
				border-radius: 20rpx;
				height: 100rpx;
				width: 100rpx;
				line-height: 100rpx;
				text-align: center;
				font-size: 56rpx;
				color: #fff;
			}
		}
	}


	// .多边形_820 {
	//   border-style: solid;
	//   border-width: 1px;
	//   border-color: rgb(95, 65, 0);
	//   background-image: -moz-linear-gradient( -90deg, rgb(255,251,243) 0%, rgb(255,251,237) 100%);
	//   background-image: -webkit-linear-gradient( -90deg, rgb(255,251,243) 0%, rgb(255,251,237) 100%);
	//   background-image: -ms-linear-gradient( -90deg, rgb(255,251,243) 0%, rgb(255,251,237) 100%);
	//   box-shadow: 0px 0px 46.41px 4.59px rgba(254, 171, 4, 0.004);
	//   position: absolute;
	//   left: 52px;
	//   top: 52px;
	//   width: 45px;
	//   height: 42px;
	//   z-index: 2;
	// }



	// .圆角矩形_11_拷贝_8 {
	//   border-radius: 20px;
	//   background-image: -moz-linear-gradient( 90deg, rgb(251,80,81) 1%, rgb(251,105,105) 100%);
	//   background-image: -webkit-linear-gradient( 90deg, rgb(251,80,81) 1%, rgb(251,105,105) 100%);
	//   background-image: -ms-linear-gradient( 90deg, rgb(251,80,81) 1%, rgb(251,105,105) 100%);
	//   box-shadow: 0px 3px 9px 0px rgba(251, 82, 83, 0.4);
	//   position: absolute;
	//   left: 8px;
	//   top: 5px;
	//   width: 86px;
	//   height: 86px;
	//   z-index: 1;
	// }
</style>